package com.chen.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Y·C
 * @version 1.0.0
 * @ClassName FileConfig.java
 * @Description TODO
 * @createTime 2023年04月23日 09:38:00
 */
@Configuration
public class FileConfig implements WebMvcConfigurer {
//    @Value("${file.save.path}")

    @Value("${file.save.path}")
    String fileSavePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/files/**").
                addResourceLocations("file:" + fileSavePath);
    }
}
